import { Switch, Tooltip } from 'antd';
import { renderTableText, tooltipLength } from '@/utils';
import pageStyles from '@/common/pageLayout.less';
import { ColumnsRenderFun } from '@/common';
import { formatDecimalFour } from '../../../Acommon';

const getTableColumns = () => {
  return [
    {
      title: '新增分类编码',
      dataIndex: 'assetClassCode',
      key: 'assetClassCode',
      visible: true,
      render: (text: string, record: Record<string, any>) => {
        return (
          <Tooltip title={tooltipLength(text, 50)}>
            <span className={pageStyles['over-flow-hidden']}>
              <div style={{ color: '100%', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{text}</div>
            </span>
          </Tooltip>
        );
      },
    },
    {
      title: '新增分类名称',
      dataIndex: 'assetClassName',
      key: 'assetClassName',
      visible: true,
      render: (text: string) => renderTableText(text, true),
    },
    {
      title: '新增资产数量',
      dataIndex: 'statisticalNum',
      key: 'statisticalNum',
      visible: true,
      render: (text: string | null, record: Record<string, any>) => {
        return <div style={{ color: '100%', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: 'block' }}>{text}</div>;
      },
    },
    {
      title: '新增金额',
      dataIndex: 'statisticalPrice',
      key: 'statisticalPrice',
      visible: true,
      render: (text: string | null, record: Record<string, any>) => {
        return <div style={{ color: '100%', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>{formatDecimalFour(text)}</div>;
      },
    },
  ];
};

export { getTableColumns };
